<template>
    <div>
        <a-input-search v-model:value="companyName" placeholder="请输入公司信息" style="width: 200px; margin-bottom: 10px"
            @search="onSearch()" />

        <a-tree v-model:selectedKeys="selectedKeys" :tree-data="data" show-icon default-expand-all @select="treeConfirm">
            <template #title="{ companyName }">
                <BankOutlined />
                {{ companyName }}
            </template>
        </a-tree>

        <!-- <el-tree :data="data" :props="{ label: 'fullName', children: 'children' }" :expand-on-click-node="false"
            :filter-node-method="filterNode" ref="companyTreeRef" highlight-current :default-expand-all="false"
            @node-click="handleNodeClick" /> -->
    </div>
</template>
<script setup>
import { BankOutlined } from '@ant-design/icons-vue';
import { queryTree } from '@/module/org/api/company';
import useApp from '@/hooks'
const { $, proxy } = useApp()
const data = ref([])
const emit = defineEmits(['confirm'])
// 叶子节点选中
function treeConfirm(keys){
    //console.log(keys)
    emit('confirm',keys[0])
}
queryTree().then(res => {
    data.value = res;
})
</script>